package com.varian.mybatis.log;

import com.varian.tool.Func;
import org.apache.ibatis.logging.Log;

/**
 * @author ben
 * @since 2024/7/1
 */
public class StdOutImpl implements Log {
    public StdOutImpl(String clazz) {
        // Do Nothing
    }

    @Override
    public boolean isDebugEnabled() {
        return true;
    }

    @Override
    public boolean isTraceEnabled() {
        return true;
    }

    @Override
    public void error(String s, Throwable e) {
        System.err.println(s);
        e.printStackTrace(System.err);
    }

    @Override
    public void error(String s) {
        System.err.println("error:" + s);
    }

    @Override
    public void debug(String s) {
        System.err.println("debug:" + s);
    }

    @Override
    public void trace(String s) {
        Func.devOpt(() -> System.err.println("trace:" + s));
    }

    @Override
    public void warn(String s) {
        System.err.println("warn:" + s);
    }
}
